package com.github.kotvertolet.youtubejextractor.models.newModels;

import com.google.gson.annotations.SerializedName;
import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

import java.io.Serializable;

/**
 * 类功能描述(类上)
 *
 * @author AnBetter
 * @since 2021-04-16
 */
public class DynamicReadaheadConfig implements Sequenceable, Serializable {
    @SerializedName("readAheadGrowthRateMs")
    private int readAheadGrowthRateMs = 0;
    @SerializedName("maxReadAheadMediaTimeMs")
    private  int maxReadAheadMediaTimeMs = 0;
    @SerializedName("minReadAheadMediaTimeMs")
    private int minReadAheadMediaTimeMs = 0;

    public static final Sequenceable.Producer<DynamicReadaheadConfig> CREATOR = new Producer<DynamicReadaheadConfig>() {
        @Override
        public DynamicReadaheadConfig createFromParcel(Parcel parcel) {
            // Initialize an instance first, then do customized unmarshlling.
            DynamicReadaheadConfig dynamicReadaheadConfig = new DynamicReadaheadConfig();
            dynamicReadaheadConfig.unmarshalling(parcel);
            return dynamicReadaheadConfig;
        }
    };

    @Override
    public boolean marshalling(Parcel parcel) {
        parcel.writeInt(this.readAheadGrowthRateMs);
        parcel.writeInt(this.maxReadAheadMediaTimeMs);
        parcel.writeInt(this.minReadAheadMediaTimeMs);
        return true;
    }

    @Override
    public boolean unmarshalling(Parcel parcel) {
        this.readAheadGrowthRateMs=parcel.readInt();
        this.maxReadAheadMediaTimeMs=parcel.readInt();
        this.minReadAheadMediaTimeMs=parcel.readInt();
        return true;
    }

    @Override
    public String toString() {
        return "DynamicReadaheadConfig{" +
                "readAheadGrowthRateMs = '" + readAheadGrowthRateMs + '\'' +
                ",maxReadAheadMediaTimeMs = '" + maxReadAheadMediaTimeMs + '\'' +
                ",minReadAheadMediaTimeMs = '" + minReadAheadMediaTimeMs + '\'' +
                "}";
    }

    public int getReadAheadGrowthRateMs() {
        return readAheadGrowthRateMs;
    }

    public void setReadAheadGrowthRateMs(int readAheadGrowthRateMs) {
        this.readAheadGrowthRateMs = readAheadGrowthRateMs;
    }

    public int getMaxReadAheadMediaTimeMs() {
        return maxReadAheadMediaTimeMs;
    }

    public void setMaxReadAheadMediaTimeMs(int maxReadAheadMediaTimeMs) {
        this.maxReadAheadMediaTimeMs = maxReadAheadMediaTimeMs;
    }

    public int getMinReadAheadMediaTimeMs() {
        return minReadAheadMediaTimeMs;
    }

    public void setMinReadAheadMediaTimeMs(int minReadAheadMediaTimeMs) {
        this.minReadAheadMediaTimeMs = minReadAheadMediaTimeMs;
    }

}
